package yingyong;

import java.util.ArrayList;
import java.util.function.Predicate;

public class test {
    public test(){

        method01();
    }

    private void method01() {
        //创建集合 初始化集合数据
        ArrayList<Integer> list = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            list.add(i);
        }
        //调用方法过滤奇数的数字
        method02(list);
    }

    private void method02(ArrayList<Integer> list) {
        list.stream().filter(this::fun).forEach(s->System.out.println(s));

    }
    public boolean fun(int i) {
        return i % 2 == 0;
    }
}
